﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using MiserBlogData.Entities;
using MiserBlogMVC.Models;

namespace MiserBlogMVC.Filter
{
    public class AuthorVisitorFilterAttribute : FilterAttribute, IActionFilter
    {

        #region IActionFilter 成员

        public void OnActionExecuted(System.Web.Mvc.ActionExecutedContext filterContext)
        {
        }

        public void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
        {
            VisitorIdentity userVIPIdentity = new VisitorIdentity();
            UserPrincipal userPrincipal = new UserPrincipal(userVIPIdentity);
            filterContext.HttpContext.User = userPrincipal;
        }

        #endregion
    }
}
